<?xml version="1.0" encoding="gb2312"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:tk="http://www.qdocuments.net" exclude-result-prefixes="tk">
  <xsl:import href="TreeTemplate_Trans.xslt"/>
  <xsl:import href="Button.xslt"/>
  <xsl:import href="TreeNode.xslt"/>
  <xsl:output method="html" indent="no"/>
  <xsl:variable name="tk:Toolkit" select="/Toolkit"/>
  <xsl:variable name="tk:XmlFile"/>
  <xsl:variable name="tk:Tables" select="document($tk:XmlFile/Toolkit/tk:Module/tk:Resolvers/tk:Resolver[@List='true']/tk:Xml)/Toolkit/tk:Table"/>
  <xsl:template match="/">
    <table width="100%" border="0" cellspacing="0" cellpadding="6">
      <tr>
        <td class="title">
          <xsl:call-template name="tk:PageTitle"/>
          <hr class="hr2"/>
        </td>
      </tr>
      <tr>
        <td>
          <table width="80%" border="0" cellspacing="1" cellpadding="1">
            <tr>
              <td width="20%" align="center" valign="top">
                <table width="100%" border="0" cellpadding="0" cellspacing="0" id="PCList">
                  <tr>
                    <td>
                      <xsl:call-template name="tk:TreeList"/>
                    </td>
                  </tr>
                </table>
              </td>
              <td width="80%" align="center" valign="top">
                <table width="100%" border="0" cellpadding="0" cellspacing="0">
                  <tr id="DetailTemplay" style="display:none">
                    <td width="100%" id="PCDetailTD">
                      <img src="../images/empty.gif" border="0" width="5"/>
                    </td>
                  </tr>
                </table>
              </td>
            </tr>
          </table>
          <br/>
          <br/>
        </td>
      </tr>
    </table>
    <script>
      var Source = '<xsl:value-of select="$tk:Source"/>';
      var PageX = '<xsl:value-of select="$tk:PageX"/>';
      <xsl:comment><![CDATA[
   			function ShowDetail(id, parentID, saveType)
   			{
      			var xml = "<?xml version='1.0' encoding='UTF-8'?><Toolkit><OtherInfo><ID>" + id + "</ID><PARENT_ID>" + parentID + "</PARENT_ID><DataSet>" + saveType + "</DataSet></OtherInfo></Toolkit>";
      			if (saveType == "Detail")
      			{
      			  PostData2("../Library/WebTreeXmlPage." + PageX + "?Source=" + Source, xml, "PCDetailTD");
      			  document.all('DetailTemplay', 0).style.display = '';
      			}
      		}
          function PostData2(webFile, xml, tdName)
          {
             var contentStr = XmlHttpPost(webFile, xml);
          	if (contentStr.substring(0,2) == "OK")
          	{
          		document.clear();
          		document.location.href = contentStr.substring(2,contentStr.length); 
          	}
          	else
          	{
          	  document.all(tdName, 0).innerHTML = contentStr;
          	}
          }
      	]]></xsl:comment>
    </script>
  </xsl:template>
  <xsl:template name="tk:TreeList">
    <div style="position:relative; width:250px; height:500px; z-index:1; overflow:auto; border:solid 1px #A09683; background-color:#FFFFFF" class="scrollBar">
      <table width="100%" border="0" cellpadding="0" cellspacing="0" id="ProductList">
        <form name="frmData">
          <tr bgcolor="#EBF1F9" height="16">
            <td colspan="10" align="center" height="20">
              <xsl:value-of select="$tk:Title"/>
            </td>
            <td colspan="1" align="right">
              <xsl:call-template name="tk:NewButton"/>
            </td>
          </tr>
          <tr>
            <td colspan="11" bgcolor="#cccccc" height="1"/>
          </tr>
          <tr>
            <td colspan="11">
              <table width="100%">
                <xsl:apply-templates select="$tk:Tables" mode="tk:Tree"/>
              </table>
            </td>
          </tr>
        </form>
      </table>
    </div>
  </xsl:template>
  <xsl:template match="tk:Table" mode="tk:Tree">
    <xsl:variable name="Data" select="$tk:Toolkit/*[local-name()=current()/@TableName]"/>
    <xsl:apply-templates select="$Data" mode="tk:TreeNode"/>
  </xsl:template>
  <xsl:template name="tk:NewButton"/>
</xsl:stylesheet>
